package com.example.myapplication.view.ui.fragment;


import android.os.Bundle;

import androidx.fragment.app.Fragment;
import androidx.navigation.Navigation;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;

import com.example.myapplication.R;


/**
 * A simple {@link Fragment} subclass.
 */
public class Fragment_B extends Fragment {
    private Button mBtnInputFragment3, mBtnBack;

    public Fragment_B() {
        // Required empty public constructor
    }


    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        View view= inflater.inflate(R.layout.fragment_fragment__b, container, false);
        mBtnInputFragment3 = view.findViewById(R.id.button2);
        mBtnBack = view.findViewById(R.id.button3);
        mBtnInputFragment3.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Navigation.findNavController(getView()).navigate(R.id.action_fragment_B_to_fragment_C); //进入第三个碎片
            }
        });

        mBtnBack.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Navigation.findNavController(getView()).popBackStack(); //返回上一个碎片
            }
        });
        return  view;
    }

}
